package io1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        Scanner scan = new Scanner(System.in);
        System.out.println("用户输入,当输入exit退出");
        while(true){
            String s = scan.nextLine();
            fos.write(s.getBytes(StandardCharsets.UTF_8));
            if("exit".equals(s)){
                break;
            }
        }
        System.out.println("写出完毕");
        fos.close();
    }
}
